package homework.api05;

import java.io.BufferedOutputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

public class FlushDemo {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos = new FileOutputStream("xrq.txt");//创建字节输出流
        BufferedOutputStream bos = new BufferedOutputStream(fos);//创建缓冲输出流
        String s ="我爱JAVA。";//输出数据
        byte[] data = s.getBytes(StandardCharsets.UTF_8);//创建数组
        bos.write(data);//输出数组
        bos.flush();
        bos.close();
        fos.close();

    }
}
